/**   
 * @Title: LotteryRecordDetailFootballCommunicater.java 
 * @Package: com.esun.rabbit2.communicaters.lotteryrecord 
 * @Description: (竞彩足球购彩详情接口) 
 * @Author: Billy qigs@500wan.com   
 * @Date: 2011-8-17 上午11:53:32  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.communicaters.lotteryrecord;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.client.ClientProtocolException;
import org.xml.sax.SAXException;

import com.esun.config.BussinessCode;
import com.esun.config.Key;
import com.esun.config.Config;
import com.esun.model.LotteryRecordDetailFootballInfo;
import com.esun.model.UserInfo;
import com.esun.network.ServerCommunicater;

/**
 * @ClassName: LotteryRecordDetailFootballCommunicater
 * @Description: (竞彩足球购彩详情接口)
 * @Author: Billy qigs@500wan.com
 * @Date: 2011-8-17 上午11:53:32
 */
public class LotteryRecordDetailFootballCommunicater extends ServerCommunicater {

	private String msgServer;
	private String USERSESSION = UserInfo.getUserInfo().getUserSession();

	public String getMsgServer() {
		return msgServer;
	}

	public void setMsgServer(String str) {
		this.msgServer = str;
	}

	public boolean isGetLotteryRecordDetail(String lotid, String pid) throws ClientProtocolException, IOException, ParserConfigurationException, SAXException {
		boolean isSucceed = false;
		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
		list.add(mapItem(Config.PASER_MID, BussinessCode.MID_GETFOOTBALL_DETAIL));
		list.add(mapItem(Config.PASER_CK, USERSESSION));
		list.add(mapItem(Key.KEY_LOTID, lotid));
		list.add(mapItem(Key.KEY_PID, pid));

		super.getServerResponse(list, true);
		setMsgServer(super.getServerMsg());
		if (super.getState() == 100) {
			isSucceed = true;
		}

		return isSucceed;
	}

	// 获取方案详情信息
	public LotteryRecordDetailFootballInfo updateFootballDetailInfo() {

		LotteryRecordDetailFootballInfo list = new LotteryRecordDetailFootballInfo();
		Hashtable<String , String>result = new Hashtable<String , String>();
		result = super.getResult();
		list.setAddTime(result.get(Key.KEY_ADDTIME));
		list.setAllMoney(result.get(Key.KEY_ALLMONEY));
		list.setBaoDi(result.get(Key.KEY_BAODI));
		list.setBaoDiMoney(result.get(Key.KEY_BAODIMONEY));
		list.setBeiShu(result.get(Key.KEY_BEISHU));
		list.setFenShu(result.get(Key.KEY_ANUMBER));
		list.setGGTyPe(result.get(Key.KEY_GGTYPE));
		list.setGGTypeName((result.get(Key.KEY_GGTYPENAME)));
		list.setIsHm(result.get(Key.KEY_ISHM));
		list.setIsManYuan(result.get(Key.KEY_ISMANYUAN));
		list.setIssuc(result.get(Key.KEY_ISSUC));
		list.setJinDu(result.get(Key.KEY_RENQI));
		list.setLeftNumber(result.get(Key.KEY_LEFTNUMBER));
		list.setZhanJiYinPai(result.get(Key.KEY_ZHANJI_YINPAI));
		list.setZhanJiJinPai(result.get(Key.KEY_ZHANJI_JINPAI));
		list.setWinMoney(result.get(Key.KEY_GETMONEY));
		list.setFaQiRen((result.get(Key.KEY_USERNAME)));
		list.setTiCheng(result.get(Key.KEY_BONUSRATIO));
		list.setState(result.get(Key.KEY_LOTTERYSTATE));
		list.setProID(result.get(Key.KEY_PROID));
		list.setPlayName(result.get(Key.KEY_PLAYNAME));
		list.setPlayID(result.get(Key.KEY_PLAYID));
		list.setOneMoney(result.get(Key.KEY_ONEMONEY));
		list.setLotteryCount(result.get(Key.KEY_LOTTERYCOUNT));
		list.setLotteryMoney(result.get(Key.KEY_LOTTERYMONERY));
		list.setFileCode(result.get(Key.KEY_FILEORCODE));
		list.setIsUpload(result.get(Key.KEY_ISUPLOAD));
		list.setIsShow(result.get(Key.KEY_ISSHOW));
		list.setGoldDiamond(result.get(Key.KEY_ZHANJI_JINZUAN));
		list.setSilverDiamond(result.get(Key.KEY_ZHANJI_YINZUAN));
		list.setGoldStar(result.get(Key.KEY_ZHANJI_JINXING));
		list.setSilverStar(result.get(Key.KEY_ZHANJI_YINXING));
		list.setGoldCup(result.get(Key.KEY_ZHANJI_JINBEI));

		for (int i = 0; i < super.getListResult().size(); i++) {

			list.setMatchNum(super.getListResult().get(i).get(Key.KEY_MATCHNUM));
			list.setHomeTeam(super.getListResult().get(i).get(Key.KEY_HOMESXNAME));
			list.setVisitingTeam(super.getListResult().get(i).get(Key.KEY_AWAYSXNAME));
			list.setScore(super.getListResult().get(i).get(Key.KEY_SCORE));
			list.setRangQiu(super.getListResult().get(i).get(Key.KEY_RANGQIU));
			list.setLotteryContent(super.getListResult().get(i).get(Key.KEY_SPF));
			list.setResult(super.getListResult().get(i).get(Key.KEY_RESULT));
			list.setIsDanMa(super.getListResult().get(i).get(Key.KEY_ISDANMA));
			list.setPeiLv(super.getListResult().get(i).get(Key.KEY_PEILV));
		}

		return list;
	}

	private HashMap<String, String> mapItem(String name, String value) {
		HashMap<String, String> map = new HashMap<String, String>();
		map.put(name, value);
		return map;
	}
}
